// http://forums.kipin.net/posting.php?mode=post&f=5
// http://forums.kipin.net/posting.php?mode=smilies&f=5
var url = 'http://forums.kipin.net/posting.php?mode=post';
url = 'http://forums.kipin.net/posting.php?mode=smilies';
if(window.location.href.indexOf(url) != -1) {
    alert(window.location.href);
    appendToSmileys();
}

functionappendToSmileys() {
    var div = document.createElement('div');
    div.appendChild(document.createElement('hr'));
    var h3 = document.createElement('h3');
    h3.appendChild(document.createTextNode('Kipin Pro'));
    div.appendChild(h3);
    
    div.appendChild(createSmiley(':dog:', 'http://i.imgur.com/0RZ0a.png'));
    div.appendChild(createSmiley(':test:', 'http://i.imgur.com/0RZ0a.png'));
    
    document.getElementsByClassName('inner')[0].appendChild(div);
}

function createSmiley(smiley, url) {
    // <a href="#" onclick="insert_text(':cutitout:', true, true); return false;"><img src="./images/smilies/icon_cutitout.gif" width="50" height="35" alt=":cutitout:" title="Cut it out" /></a> 
    var link, image;
    link = document.createElement('a');
    link.setAttribute('href', '#');
    link.setAttribute('onclick', 'insert_text(\'' + smiley + '\', true, true); return false;\')';
    image = document.createElement('img');
    image.setAttribute('src', url);
    image.setAttribute('alt', smiley);
    image.setAttribute('title', smiley);
    link.appendChild(image);
    return link;
}
